package data;

import java.util.ArrayList;

import beans.Content;

/*
 * Author: Minh-Tuan Ta
 * Date: 11/6/11
 * Class: StatusDB
 * This class is the data access class for status
 */
public class StatusDB extends ContentDB {
	/*
	 * Author: Minh-Tuan Ta
	 * Date: 11/7/11
	 * Method: getStatuses
	 * This method will get all the statuses in the database
	 */
	public static synchronized ArrayList<Content> getStatuses()
	{
		return getAllContentOfContenttype(ContentTypeDB.getContentTypeID("Status"));
	}
	
	/*
	 * Author: Minh-Tuan Ta
	 * Date: 11/7/11
	 * Method: getStatusesOfUser
	 * This method will get all the statuses of a specific user in the database
	 */
	public static synchronized ArrayList<Content> getStatusesOfUser(int userid)
	{
		return getContentsOfUserAndType(userid, ContentTypeDB.getContentTypeID("Status"));
	}
	
	/*
	 * Author: Minh-Tuan Ta
	 * Date: 11/7/11
	 * Method: getStatusesToUser
	 * This method will get all the statuses sent to a specific user in the database
	 */
	public static synchronized ArrayList<Content> getStatusesToUser(int userid)
	{
		return getContentOfExtraAndType(userid, ContentTypeDB.getContentTypeID("Status"));
	}
	
	/*
	 * Author: Minh-Tuan Ta
	 * Date: 11/7/11
	 * Method: getStatus
	 * This method will get a status from the database giving the specific status id
	 */
	public static synchronized Content getStatus(int statusid)
	{
		return getContent(statusid);
	}
	
	/*
	 * Author: Minh-Tuan Ta
	 * Date: 11/7/11
	 * Method: addStatus
	 * This method will add a new status
	 */
	public static synchronized int addStatus(Content status)
	{
		return addContent(status);
	}
	
	/*
	 * Author: Minh-Tuan Ta
	 * Date: 11/7/11
	 * Method: deleteMessage
	 * This method will delete a status
	 */
	public static synchronized int deleteStatus(Content status)
	{
		return deleteContent(status);
	}
}
